﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Genuilder.Extensibility
{
	public enum SourceType
	{
		Compile,
		None,
		Page
	}
	public class SourceFile
	{
		public SourceFile(string name, Extensibility.SourceType sourceType)
		{
			if(name == null)
				throw new ArgumentNullException("name");
			_Name = name;
			_SourceType = sourceType;
			_hashCode = Tuple.Create(Name, SourceType).GetHashCode();
		}

		int _hashCode;

		private readonly SourceType _SourceType;
		public SourceType SourceType
		{
			get
			{
				return _SourceType;
			}
		}
		private readonly string _Name;
		public string Name
		{
			get
			{
				return _Name;
			}
		}


		public override string ToString()
		{
			return SourceType.ToString() + " " + Name;
		}

		public override bool Equals(object obj)
		{
			SourceFile item = obj as SourceFile;
			if(item == null)
				return false;
			return _hashCode.Equals(item._hashCode);
		}

		public override int GetHashCode()
		{
			return _hashCode;
		}
	}
}
